﻿@model VideoGiaitri.Models.topgame

@{
    ViewBag.title = System.Web.HttpUtility.HtmlDecode(Model.title);
    ViewBag.des = ViewBag.title;
    ViewBag.url = VideoGiaitri.Uti.domain+"/Lmht/Xem/"+@Model.id;
    ViewBag.image = @Model.image;
    Layout = "~/Views/Shared/_LayoutLmht.cshtml";
}

<script src="~/Scripts/jquery-1.8.2.js"></script>


<div class="container" id="main-content" style="padding-left:2px;padding-right:1px;"> 
    <div class="list-post  margin-b-10">    
        <div class="col-md-8 padding-0" id="left-col">
            <div class="article">
                    <h2>@Html.Raw(@Model.title)</h2><br /> 
                    <div class="fb-like" data-href="@VideoGiaitri.Uti.domain/Lmht/Xem/@Model.id" data-layout="button_count" data-action="like" data-show-faces="false" data-share="true" data-width="20" style="float:left;position:relative;display:block;margin: 0px 0px 0px 0px;"></div>                                                                
                    <div class="g-plus" data-action="share" data-annotation="none" style="float:right;position:relative;display:block;margin: 0px 0px 0px 0px;"></div>
                    <div class="twitter" style="float:right;position:relative;display:block;margin: 0px 0px 0px 0px;"><a href="https://twitter.com/share" class="twitter-share-button" data-lang="vn" url="@VideoGiaitri.Uti.domain/Lmht/Xem/@Model.id"></a></div>    
                    @Html.Raw(@Server.HtmlDecode(@Model.fullcontent)) 
                    <br/>Nguồn:<a href="@Model.link" target="_blank">@Model.domain</a><br/>
                   <div class="fb-comments" data-href="@VideoGiaitri.Uti.domain/Lmht/Xem/@Model.id" data-numposts="5" data-colorscheme="light" ></div>         
                <div style="display:block;position:relative;float:left;width:100%;">  
                    <h3 class="list-video-title">Video khác</h3>                      
                    <ul class="list-hot-video" id="oldNews">
                    </ul>
                </div>
            </div>    
            <div class="clear-fix"></div> 
        </div>    
        <div class="col-md-4 padding-r-0 padding-l-10" id="right-col">
            <div class="list-video">
                <div>
                    <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
                    <!-- Right Banner -->
                    <ins class="adsbygoogle"
                         style="display:inline-block;width:300px;height:250px"
                         data-ad-client="ca-pub-6575239088642506"
                         data-ad-slot="9661626879"></ins>
                    <script>
                        (adsbygoogle = window.adsbygoogle || []).push({});
                    </script>
                </div>
                <h3 class="list-video-title">Mới nhất</h3>  
                 <ul class="list-hot-video" id="relatedNews">
                     
                 </ul>
            </div>
        </div>  
    </div>
    
</div>
<script>
    var minID=@Model.id;
    function getRelated() {    
        //Creating an XMLHttpRequest and sending
        //$("#dvTopNewsWeekly").show();
        var formdata = new FormData(); //FormData object
        formdata.append("id", @Model.id);
        var xhr = new XMLHttpRequest();
        xhr.open('POST', '/Lmht/getRelatedGame');
        xhr.send(formdata);
        var content = "";
        xhr.onreadystatechange = function () {
            if (xhr.readyState == 4 && xhr.status == 200) {
                var news = '{"news":' + xhr.responseText + '}';
                //alert(news);
                var json_parsed = $.parseJSON(news);
                var removeDuplicate = "";
                var title = "";
                for (var i = 0; i <10; i++) {
                    if (json_parsed.news[i]) {
                        var n = json_parsed.news[i];
                        if (n.title != "" && n.title != null && removeDuplicate.indexOf(n.title) < 0) {
                            title = n.title.replace(/&#39;/g, "");
                            content+="<li style=\"width:90%;\">";
                            content+="<a href=\"/Lmht/Xem/"+n.id+"\" title=\""+title+"\">";
                            // content+="<span class=\"play-icon\"></span>";
                            //content+="<span class=\"background-video\"></span>";
                            content+="<img src=\""+n.image+"\" class=\"img-related\">";
                            content+="<span class=\"title-related\">"+title+"</span>";
                            content+="</a>";
                            content+="</li>";
                            removeDuplicate += n.title + ",";
                            if (n.id<minID) minID=n.id;
                        }
                    }
                }
                if (json_parsed.news.length>0) 
                {
                    $("#relatedNews").html(content);
                    getOldRelated();
                }
            }
        }
    }
    getRelated();
    
    function getOldRelated() { 
        //alert(minID);
        //Creating an XMLHttpRequest and sending
        //$("#dvTopNewsWeekly").show();
        var formdata = new FormData(); //FormData object
        formdata.append("id", minID);
        var xhr = new XMLHttpRequest();
        xhr.open('POST', '/Lmht/getOldRelatedGame');
        xhr.send(formdata);
        var content = "";
        xhr.onreadystatechange = function () {
            if (xhr.readyState == 4 && xhr.status == 200) {
                var news = '{"news":' + xhr.responseText + '}';
                //alert(news);
                var json_parsed = $.parseJSON(news);
                var removeDuplicate = "";
                var title = "";
                for (var i = 0; i <10; i++) {
                    if (json_parsed.news[i]) {
                        var n = json_parsed.news[i];
                        if (n.title != "" && n.title != null && removeDuplicate.indexOf(n.title) < 0) {
                            title = n.title.replace(/&#39;/g, "");
                            content+="<li style=\"width:27%;\">";
                            content+="<a href=\"/Lmht/Xem/"+n.id+"\" title=\""+title+"\">";
                            // content+="<span class=\"play-icon\"></span>";
                            //content+="<span class=\"background-video\"></span>";
                            content+="<img src=\""+n.image+"\" class=\"img-related\">";
                            content+="<span class=\"title-related\">"+title+"</span>";
                            content+="</a>";
                            content+="</li>";
                            removeDuplicate += n.title + ",";
                        }
                    }
                }
                if (json_parsed.news.length>0) 
                {
                    $("#oldNews").html(content);
                }
            }
        }
    }    
    $("iframe").css("width","95%");
    $("iframe").css("minHeight","395px");
    //$("iframe").css("height","auto");
</script>
 <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
    <script src="https://apis.google.com/js/platform.js" async defer>
        {lang: 'vi'}
    </script>